using System;
using System.Drawing;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

using Weazel.Toad.Application.Actions;

namespace Weazel.Toad.Application.Controls.FileToolStrip
{
  public class FileToolStrip
    : ToadToolStrip
  {
    private ToolStripButton newFileButton;
    private ToolStripButton openFileButton;
    private ToolStripButton saveFileButton;
    private ToolStripButton saveAllButton;

    public FileToolStrip()
    {
      Image newFileImage = GraphicsLoader.LoadImage(GetType(), "newfile.png");
      Image openFileImage = GraphicsLoader.LoadImage(GetType(), "open.png");
      Image saveFileImage = GraphicsLoader.LoadImage(GetType(), "save.png");
      Image saveAllImage = GraphicsLoader.LoadImage(GetType(), "saveall.png");


      this.newFileButton = new ToolStripButton(newFileImage);
      this.newFileButton.ToolTipText = "New Gezel model";

      this.openFileButton = new ToolStripButton(openFileImage);
      this.openFileButton.ToolTipText = "Open Gezel model";

      this.saveFileButton = new ToolStripButton(saveFileImage);
      this.saveFileButton.ToolTipText = "Save";

      this.saveAllButton = new ToolStripButton(saveAllImage);
      this.saveAllButton.ToolTipText = "Save all files";

      this.Items.AddRange(
        new ToolStripItem[] {
          newFileButton,
          openFileButton,
          saveFileButton,
          saveAllButton
        }
      );
    }

    public override void BindActions()
    {
      ActionBase.Actions[typeof(NewGezelModelAction)].BindToolStripItem(newFileButton);
      ActionBase.Actions[typeof(OpenGezelModelAction)].BindToolStripItem(openFileButton);
      ActionBase.Actions[typeof(SaveSelectedItemAction)].BindToolStripItem(saveFileButton);
      ActionBase.Actions[typeof(SaveAllAction)].BindToolStripItem(saveAllButton);
    }
  }
}